<template>
  <div id="unit" class="flex-row">
    <bank-list v-ref:list :row="row" @select-changed="selected"  style="width:auto;"></bank-list>
    <div class="flex" style="margin-left: 10px; width: 50%;" v-if="isChange">
        <bank-form v-if="isChange" :data="boxmodel" v-ref:addbox></bank-form>
    </div>
 </div>
</template>
<script>
import LoadData from '../../../plugins/revenueService/LoadData'

export default {
  title: '银行对接',
  data () {
    return {
      isChange: false,
      row: null,
      boxmodel: null
    }
  },
  methods: {
    selected (obj) {
      this.isChange = true
      this.row = obj.val
      this.boxmodel = obj.val
    },
    getChange () {
      this.isChange = true
    }
  },
  events: {
    'search' () {
      this.isChange = false
      this.row = null
      this.boxmodel = {}
      this.$refs.list.$refs.paged.$refs.cri.search()
    },
    'success' (name, row, res) {
      this.isChange = false
      this.row = null
      this.boxmodel = {}
      LoadData.load()
      this.$refs.list.search()
    },
    'error' (name, row, res) {
      this.isChange = false
      this.row = null
      this.boxmodel = {}
    },
    'close' () {
      this.isChange = false
      this.row = null
      this.boxmodel = {}
      this.$refs.list.search()
    },
    'add' () {
      this.isChange = true
      this.row = null
      this.boxmodel = {}
      this.$refs.list.$refs.paged.$refs.grid.selectStore.selected = null
    }
  }
}
</script>
